package cn.aloxc.tianya.reader;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class ActivityTest extends Activity{

	
	Button linear_button = null;
	Button relative_button = null;
	Button hunhe_button = null;
	Button table_button = null;
	Button frame_button = null;
	Button list_button = null;
	Button xmllist_button = null;
	Button editText_button = null;
	Button spinner_button = null;
	Button dialog_button = null;
	Button tabview_button = null;
	Button sqlite_button = null;
	Button broad_button = null;
	Button service_button = null;
	Button autowire_button = null;
	
	OnClickListener linear_listener = null;
	OnClickListener relative_listener = null;
	OnClickListener hunhe_listener = null;
	OnClickListener table_listener = null;
	OnClickListener frame_listener = null;
	OnClickListener list_listener = null;
	OnClickListener xmllist_listener = null;
	OnClickListener editText_listener = null;
	OnClickListener spinner_listener = null;
	OnClickListener dialog_listener = null;
	OnClickListener tabview_listener = null;
	OnClickListener sqlite_listener = null;
	OnClickListener broad_listener = null;
	OnClickListener service_listener = null;
	OnClickListener autowire_listener = null;
	private void hideTitle(){
		//隐藏标题
		requestWindowFeature(Window.FEATURE_NO_TITLE);
	}
	private void hideStatusBar(){
		//隐藏标题
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		//定义全屏幕参数
		int flag = WindowManager.LayoutParams.FLAG_FULLSCREEN;
		Window window = this.getWindow();
		window.setFlags(flag, flag);
	}
	public void onCreate(Bundle savedInstanceState) {
		this.hideTitle();
		this.hideStatusBar();
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_test);
		Bundle data = this.getIntent().getExtras();
		setTitle(data.getString("testItem"));
		this.getWindow().setBackgroundDrawableResource(R.drawable.caoyuan);
		linear_listener = new OnClickListener(){
			public void onClick(View v) {
				Intent intent = new Intent(ActivityTest.this,
						Activity_test_linearlayout.class);
				Bundle data = new Bundle();
				String text = (String) ((Button) v).getText();
				data.putString("testItem", text);
				intent.putExtras(data);
				startActivity(intent);
			}
		};
		relative_listener = new OnClickListener(){
			public void onClick(View v) {
				Intent intent = new Intent(ActivityTest.this,
						Activity_test_relativelayout.class);
				Bundle data = new Bundle();
				String text = (String) ((Button) v).getText();
				data.putString("testItem", text);
				intent.putExtras(data);
				startActivity(intent);
			}
		};
		hunhe_listener = new OnClickListener(){
			public void onClick(View v) {
				Intent intent = new Intent(ActivityTest.this,
						Activity_test_hunhelayout.class);
				Bundle data = new Bundle();
				String text = (String) ((Button) v).getText();
				data.putString("testItem", text);
				intent.putExtras(data);
				startActivity(intent);
			}
		};
		table_listener = new OnClickListener(){
			public void onClick(View v) {
				Intent intent = new Intent(ActivityTest.this,
						Activity_test_tablelayout.class);
				Bundle data = new Bundle();
				String text = (String) ((Button) v).getText();
				data.putString("testItem", text);
				intent.putExtras(data);
				startActivity(intent);
			}
		};
		frame_listener = new OnClickListener(){
			public void onClick(View v) {
				Intent intent = new Intent(ActivityTest.this,
						Activity_test_framelayout.class);
				Bundle data = new Bundle();
				String text = (String) ((Button) v).getText();
				data.putString("testItem", text);
				intent.putExtras(data);
				startActivity(intent);
			}
		};
		list_listener = new OnClickListener(){
			public void onClick(View v) {
				Intent intent = new Intent(ActivityTest.this,
						Activity_test_list.class);
				Bundle data = new Bundle();
				String text = (String) ((Button) v).getText();
				data.putString("testItem", text);
				intent.putExtras(data);
				startActivity(intent);
			}
		};
		xmllist_listener = new OnClickListener(){
			public void onClick(View v) {
				Intent intent = new Intent(ActivityTest.this,
						Activity_test_Xmllist.class);
				Bundle data = new Bundle();
				String text = (String) ((Button) v).getText();
				data.putString("testItem", text);
				intent.putExtras(data);
				startActivity(intent);
			}
		};
		
		editText_listener = new OnClickListener(){
			public void onClick(View v) {
				EditText et = (EditText) findViewById(R.id.test_editText);
				setTitle(et.getText());
			}
		};
		spinner_listener = new OnClickListener(){
			public void onClick(View v) {
				Intent intent = new Intent(ActivityTest.this,Activity_test_spinner.class);
				Bundle data = new Bundle();
				String text = (String) ((Button) v).getText();
				data.putString("testItem", text);
				intent.putExtras(data);
				startActivity(intent);
			}
		};
		dialog_listener = new OnClickListener(){
			public void onClick(View v) {
				Intent intent = new Intent(ActivityTest.this,Activity_test_dialog.class);
				Bundle data = new Bundle();
				String text = (String) ((Button) v).getText();
				data.putString("testItem", text);
				intent.putExtras(data);
				startActivity(intent);
			}
		};
		tabview_listener = new OnClickListener(){
			public void onClick(View v) {
				Intent intent = new Intent(ActivityTest.this,Activity_test_tabview.class);
				Bundle data = new Bundle();
				String text = (String) ((Button) v).getText();
				data.putString("testItem", text);
				intent.putExtras(data);
				startActivity(intent);
			}
		};
		sqlite_listener = new OnClickListener(){
			public void onClick(View v) {
				Intent intent = new Intent(ActivityTest.this,Activity_test_SqlLite.class);
				Bundle data = new Bundle();
				String text = (String) ((Button) v).getText();
				data.putString("testItem", text);
				intent.putExtras(data);
				startActivity(intent);
			}
		};
		broad_listener = new OnClickListener(){
			public void onClick(View v) {
				Intent intent = new Intent(ActivityTest.this,
						Activity_test_broadAintent.class);
				Bundle data = new Bundle();
				String text = (String) ((Button) v).getText();
				data.putString("testItem", text);
				intent.putExtras(data);
				startActivity(intent);
			}
		};
		service_listener = new OnClickListener(){
			public void onClick(View v) {
				Intent intent = new Intent(ActivityTest.this,
						Activity_test_broadAintent.class);
				Bundle data = new Bundle();
				String text = (String) ((Button) v).getText();
				data.putString("testItem", text);
				intent.putExtras(data);
				startActivity(intent);
			}
		};	

		linear_button = (Button) findViewById(R.id.t_linear);
		relative_button = (Button) findViewById(R.id.t_relative);
		hunhe_button = (Button) findViewById(R.id.t_hunhe);
		table_button = (Button) findViewById(R.id.t_table);
		frame_button = (Button) findViewById(R.id.t_frame);
		list_button = (Button) findViewById(R.id.t_list);
		xmllist_button = (Button) findViewById(R.id.t_xmllist);
		editText_button = (Button) findViewById(R.id.test_editText_OK);
		spinner_button = (Button) findViewById(R.id.test_spinner);
		dialog_button = (Button) findViewById(R.id.t_dialog);
		tabview_button = (Button) findViewById(R.id.t_tabview);
		sqlite_button = (Button) findViewById(R.id.t_sqlite);
		broad_button = (Button) findViewById(R.id.t_broadcast);
		service_button = (Button) findViewById(R.id.t_service);
		autowire_button = (Button) findViewById(R.id.t_autowire);
		
		linear_button.setOnClickListener(linear_listener);
		relative_button.setOnClickListener(relative_listener);
		hunhe_button.setOnClickListener(hunhe_listener);
		table_button.setOnClickListener(table_listener);
		frame_button.setOnClickListener(frame_listener);
		list_button.setOnClickListener(list_listener);
		xmllist_button.setOnClickListener(xmllist_listener);
		editText_button.setOnClickListener(editText_listener);
		spinner_button.setOnClickListener(spinner_listener);
		dialog_button.setOnClickListener(dialog_listener);
		tabview_button.setOnClickListener(tabview_listener);
		sqlite_button.setOnClickListener(sqlite_listener);
		broad_button.setOnClickListener(broad_listener);
		service_button.setOnClickListener(service_listener);
		autowire_button.setOnClickListener(autowire_listener);
	}
	
	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		super.onActivityResult(requestCode, resultCode, data);
	}
}
